home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / CrtPipelin.3 < prev    next >
Text File  |  1995-07-25  |  12KB  |  199 lines

  1.  
  2.  
  3.  
  4.      TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))        TTTTccccllll (((( ))))        TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tcl_CreatePipeline - create one  or  more  child  processes,
  12.           with I/O redirection
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  16.  
  17.           int
  18.           TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee(_i_n_t_e_r_p, _a_r_g_c, _a_r_g_v, _p_i_d_A_r_r_a_y_P_t_r, _i_n_P_i_p_e_P_t_r, _o_u_t_P_i_p_e_P_t_r, _e_r_r_F_i_l_e_P_t_r)
  19.  
  20.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  21.           Tcl_Interp   *_i_n_t_e_r_p         (in)      Interpreter  to   use
  22.                                                  for error reporting.
  23.  
  24.           int          _a_r_g_c            (in)      Number of strings  in
  25.                                                  _a_r_g_v array.
  26.  
  27.           char         **_a_r_g_v          (in)      Array   of    strings
  28.                                                  describing command(s)
  29.                                                  and I/O redirection.
  30.  
  31.           int          **_p_i_d_A_r_r_a_y_P_t_r   (out)     The     value      at
  32.                                                  *_p_i_d_A_r_r_a_y_P_t_r       is
  33.                                                  modified  to  hold  a
  34.                                                  pointer  to  an array
  35.                                                  of            process
  36.                                                  identifiers.      The
  37.                                                  array is  dynamically
  38.                                                  allocated and must be
  39.                                                  freed by the caller.
  40.  
  41.           int          *_i_n_P_i_p_e_P_t_r      (out)     If this  argument  is
  42.                                                  NULL   then  standard
  43.                                                  input for  the  first
  44.                                                  command     in    the
  45.                                                  pipeline  comes  from
  46.                                                  the  current standard
  47.                                                  input.  If  _i_n_P_i_p_e_P_t_r
  48.                                                  is   not   NULL  then
  49.                                                  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee
  50.                                                  will  create  a pipe,
  51.                                                  arrange for it to  be
  52.                                                  used   for   standard
  53.                                                  input  to  the  first
  54.                                                  command,  and store a
  55.                                                  file id  for  writing
  56.                                                  to   that   pipe   at
  57.                                                  *_i_n_P_i_p_e_P_t_r.   If  the
  58.                                                  command specified its
  59.                                                  own    input    using
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))        TTTTccccllll (((( ))))        TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))
  71.  
  72.  
  73.  
  74.                                                  redirection,  then no
  75.                                                  pipe is  created  and
  76.                                                  -1   is   stored   at
  77.                                                  *_i_n_P_i_p_e_P_t_r.
  78.  
  79.           int          *_o_u_t_P_i_p_e_P_t_r     (out)     If this  argument  is
  80.                                                  NULL   then  standard
  81.                                                  output for  the  last
  82.                                                  command     in    the
  83.                                                  pipeline goes to  the
  84.                                                  current      standard
  85.                                                  output.            If
  86.                                                  _o_u_t_P_i_p_e_P_t_r   is   not
  87.                                                  NULL             then
  88.                                                  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee
  89.                                                  will create  a  pipe,
  90.                                                  arrange  for it to be
  91.                                                  used   for   standard
  92.                                                  output  from the last
  93.                                                  command, and store  a
  94.                                                  file  id  for reading
  95.                                                  from  that  pipe   at
  96.                                                  *_o_u_t_P_i_p_e_P_t_r.   If the
  97.                                                  command specified its
  98.                                                  own    output   using
  99.                                                  redirection  then  no
  100.                                                  pipe  is  created and
  101.                                                  -1   is   stored   at
  102.                                                  *_o_u_t_P_i_p_e_P_t_r.
  103.  
  104.           int          *_e_r_r_F_i_l_e_P_t_r     (out)     If this  argument  is
  105.                                                  NULL    then    error
  106.                                                  output  for  all  the
  107.                                                  commands    in    the
  108.                                                  pipeline will  go  to
  109.                                                  the  current standard
  110.                                                  error    file.     If
  111.                                                  _e_r_r_F_i_l_e_P_t_r   is   not
  112.                                                  NULL,  error   output
  113.                                                  from all the commands
  114.                                                  in the pipeline  will
  115.                                                  go   to  a  temporary
  116.                                                  file    created    by
  117.                                                  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee.
  118.                                                  A  file  id  to  read
  119.                                                  from  that  file will
  120.                                                  be     stored      at
  121.                                                  *_e_r_r_F_i_l_e_P_t_r.      The
  122.                                                  file   will   already
  123.                                                  have been removed, so
  124.                                                  closing   the    file
  125.                                                  descriptor         at
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/10/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))        TTTTccccllll (((( ))))        TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee((((3333))))
  137.  
  138.  
  139.  
  140.                                                  *_e_r_r_F_i_l_e_P_t_r      will
  141.                                                  cause  the file to be
  142.                                                  flushed completely.
  143.      _________________________________________________________________
  144.  
  145.  
  146.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  147.           TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee processes the _a_r_g_v array and sets up  one
  148.           or   more  child  processes  in  a  pipeline  configuration.
  149.           TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee handles pipes specified with ``|'', input
  150.           redirection  specified  with  ``<''  or  ``<<'',  and output
  151.           redirection specified with ``>'';  see the documentation for
  152.           the  eeeexxxxeeeecccc  command for details on these specifications.  The
  153.           return value from  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee  is  a  count  of  the
  154.           number  of child processes created;  the process identifiers
  155.           for those processes are stored in a _m_a_l_l_o_c-ed  array  and  a
  156.           pointer  to that array is stored at *_p_i_d_A_r_r_a_y_P_t_r.  It is the
  157.           caller's responsibility to free the array when finished with
  158.           it.
  159.  
  160.           If the _i_n_P_i_p_e_P_t_r, _o_u_t_P_i_p_e_P_t_r, and _e_r_r_F_i_l_e_P_t_r  arguments  are
  161.           NULL  then  the  pipeline's standard input, standard output,
  162.           and standard error are taken from the corresponding  streams
  163.           of  the process.  Non-NULL values may be specified for these
  164.           arguments to use  pipes  for  standard  input  and  standard
  165.           output  and  a  file for standard error.  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee
  166.           will create the requested pipes  or  file  and  return  file
  167.           identifiers  that  may be used to read or write them.  It is
  168.           the caller's responsibility to close all of these files when
  169.           they  are  no  longer needed.  If _a_r_g_v specifies redirection
  170.           for standard input or standard output, then pipes  will  not
  171.           be created even if requested by the _i_n_P_i_p_e_P_t_r and _o_u_t_P_i_p_e_P_t_r
  172.           arguments.
  173.  
  174.           If an error occurs  in  TTTTccccllll____CCCCrrrreeeeaaaatttteeeePPPPiiiippppeeeelllliiiinnnneeee  (e.g.  ``|''  or
  175.           ``<''  was  the last argument in _a_r_g_v, or it wasn't possible
  176.           to fork off a child), then -1 is returned and _i_n_t_e_r_p->_r_e_s_u_l_t
  177.           is set to an error message.
  178.  
  179.  
  180.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  181.           TTTTccccllll____DDDDeeeettttaaaacccchhhhPPPPiiiiddddssss, TTTTccccllll____RRRReeeeaaaappppDDDDeeeettttaaaacccchhhheeeeddddPPPPrrrrooooccccssss
  182.  
  183.  
  184.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  185.           background, child, detach, fork, process, status, wait
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/10/95)
  196.  
  197.  
  198.  
  199.